{extend name="v1/layout/base"}
{block name="content"}
<div class="layuimini-main">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-row layui-col-space15">
        <table class="layui-table">
          <colgroup>
            <col width="150">
            <col width="200">
            <col width="200">
            <col>
          </colgroup>
          <thead>
            <th>距离查询代数</th>
            <th>用户编号</th>
            <th>用户昵称</th>
            <th>当前等级</th>
            <th>总佣金</th>
            <th>团队总业绩</th>
            <th>个人总业绩</th>
            <th>消费总金额</th>
          </thead>
          <tbody id="list_show">
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
{/block}
{block name="myScript"}
<script>
  layui.use(['form'], function() {
    var form = layui.form,
      layer = layui.layer,
      user_sn = '{$user_sn}',
      $ = layui.$;
      getInfo(user_sn,0);
      function getInfo(user_sn,level){
        var url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/User/parentList')}";
        https(url, {user_sn:user_sn}, 'post', 0, '').then(res => {
          var user_info = res.resultData.user_info;
          var html = '';
          if(user_info){
            html += '<tr><td>'+level+'</td><td>'+user_info['user_sn']+'</td><td>'+user_info['user_name']+'</td><td>'+user_info['level_name']+'</td><td>'+user_info['all_back_money']+'</td><td>'+user_info['all_achievement_price']+'</td><td>'+user_info['agent_achievement_price']+'</td><td>'+user_info['purchases_order_price']+'</td></tr>';
            $("#list_show").append(html);
            if(user_info['l_user_sn'] > 0){
              getInfo(user_info['l_user_sn'],level+1);
            }
          }
        }, fail => {})
      }
  });
</script>
{/block}
